package com.hequ.merchant.banner.api;

import com.hequ.merchant.banner.entity.Banner;
import com.hequ.merchant.banner.handler.BannerJsonResponseHandler;

import org.json.JSONException;

import java.util.List;

/**
 * Created by 柯尊诚 on 2015/10/28.
 * kzc
 */
public class BannerDownRequest extends BannerRequest<List<Banner>>{

    private BannerJsonResponseHandler handler = new BannerJsonResponseHandler();

    public BannerDownRequest(OnRequestListener<List<Banner>> listener) {
        super(Method.GET, "/banners/disabled", listener);
    }

    @Override
    public List<Banner> parseResponse(String result) {
        try {
            handler.parse(result);
        } catch (JSONException e) {
            e.printStackTrace();
        }
        return handler.getParsedItems();
    }
}
